#ifndef OGREWINDOW_H
#define OGREWINDOW_H

#include <Ogre.h>
#include <QWidget>
#include <QPoint>

#include "ogrecontext.h"
#include "propertybrowser/common.h"

using namespace Ogre;

#include <QColor>

enum ShapeType
{
	Em_Axes,
	Em_Grid,
	Em_Roi3D
};

class Axes;
class Grid;
class Shape;
class Roi3D;
class OgreWindow : public QWidget
{
    Q_OBJECT
public:
    OgreWindow(QWidget* parent = nullptr);
	void setBackgroundColor(QColor color);
	void setupProperty(QVector<PropGroup> vGroup);
	void showShape(bool show, Shape* shape);
	Shape* getShape(ShapeType type);

protected:
	void showEvent(QShowEvent* event) override;
	void mousePressEvent(QMouseEvent* event) override;
	void mouseMoveEvent(QMouseEvent* event) override;
	void mouseReleaseEvent(QMouseEvent* event) override;

	void wheelEvent(QWheelEvent* event) override;
	QPaintEngine* paintEngine() const override;

signals:
	void signal_propertyInfo(QVector<PropGroup> vGroup);

private:
	void setupContext();
	void setupScene();
	void mouseScale(int deltaY);
	void mouseRotate(QPoint last, QPoint now);
	void mouseMove(QPoint last, QPoint now);

	OgreContext m_tOgreCtx;
	QPoint		m_tLastMousePoint;

	Ogre::Vector3f	m_tFocalPoint;
	Camera*		m_pCamera;
	Light*		m_pMainLight;
	SceneManager*m_pSceneManager;
	float		m_nRadYaw;
	float		m_nRadPitch;

	QVector<PropGroup>	m_vPropGroup;
	QVector<Shape*>	m_vShape;

	Roi3D* m_pRoi3D;
	Grid* m_pGrid;
	Axes* m_pAxes;
};

#endif
